/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trocabi.Socle;

/**
 *
 * @author philippe
 */
public class StringTools {
    static public String escape(String value) {
        return value.replaceAll("'", "\\\\'");
    }
    
    static public String unEscape(String value) {
        return value.replaceAll("\\\\'","'");
    }
    
    public static void main(String args[]) {
        System.out.println(String.format("[%s]",escape("adazdazdazd")));
        System.out.println(String.format("[%s]",escape("ada'zda\"zdazd")));
        
        System.out.println(String.format("[%s]",unEscape(escape("ada'zda\"zdazd"))));
    }
}
